/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __COLOR_PICKER_H__
#define __COLOR_PICKER_H__

#include <QtGui/QWidget>

namespace PQBuilder
{
	//only use Qt to construct our widget
	class ColorPicker : 
		public QWidget
	{
		Q_OBJECT
	public:
		 ColorPicker(QWidget *parent = 0);

		 inline void setColor(QColor color)
		 { 
			 if(_color!=color){
				 _color=color;
				emit colorChanged(color);
			 }
		 }

		 inline QColor getColor()
		 {
			 return _color;
		 }
	signals:
		void colorChanged(QColor color);
	 protected:
		void paintEvent(QPaintEvent *evt);
		void mousePressEvent(QMouseEvent *evt);
		void mouseDoubleClickEvent( QMouseEvent *evt );
	private:
		QColor _color;
	};
}

#endif
